import React, { Component } from "react";
import { Consumer } from "./context";

class Child2 extends Component {
  render() {
    return (
      <>
        {/* <button>-</button>
        <Consumer>{(value) => <span>{value.count}</span>}</Consumer>
        <button>+</button> */}

        <Consumer>
          {(value) => (
            <>
              <button onClick={value.decrement}>-</button>
              <span>{value.count}</span>
              <button onClick={value.increment}>+</button>
            </>
          )}
        </Consumer>
      </>
    );
  }
}

export default Child2;
